import router from "@/router/index";
import { getToken } from "@/utils/auth";
router.beforeEach((to, from, next) => {
  const token = getToken();
  const whiteList = ["/login", "/404"];
  if (token) {
    next();
  } else {
    if (whiteList.includes(to.path)) {
      next();
    } else {
      next("/login");
    }
  }
});
